'\" t
.\"     Title: \fBmysqlrpladmin\fR
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\"      Date: 01/14/2017
.\"    Manual: MySQL Utilities
.\"    Source: MySQL 1.6.4
.\"  Language: English
.\"
.TH "\FBMYSQLRPLADMIN\FR" "1" "01/14/2017" "MySQL 1\&.6\&.4" "MySQL Utilities"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
mysqlrpladmin \- Administration Utility for MySQL replication
.SH "SYNOPSIS"
.HP \w'\fBmysqlrpladmin\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u
\fBmysqlrpladmin [\fR\fB\fIoptions\fR\fR\fB]\fR
.SH "DESCRIPTION"
.PP
This utility permits users to perform administrative actions on a replication topology consisting of a single master and its slaves\&. The utility is designed to make it easy to recover from planned maintenance of the master, or from an event that takes the master offline unexpectedly\&.
.PP
The act of taking the master offline intentionally and switching control to another slave is called switchover\&. In this case, there is no loss of transactions as the master is locked and all slaves are allowed to catch up to the master\&. Once the slaves have read all events from the master, the master is shutdown and control switched to a slave (in this case called a candidate slave)\&.
.PP
Recovering from the loss of a downed master is more traumatic and since there is no way to know what transactions the master may have failed to send, the new master (called a candidate slave) must be the slave that is most up\-to\-date\&. How this is determined depends on the version of the server (see below)\&. However, it can result in the loss of some transactions that were executed on the downed master but not sent to the slaves\&.
.PP
The utility accepts a list of slaves to be considered the candidate slave\&. If no slave is found to meet the requirements, the operation searches the list of known slaves\&.
.PP
Detection of a downed master is performed as follows\&. If the connection to the master is lost, wait
\fB\-\-ping\fR
seconds and check again\&. If the master connection is lost and the master cannot be pinged or reconnected, the failover event occurs\&.
.PP
For all commands that require specifying multiple servers, the options require a comma\-separated list of connection parameters in the following form (where the password, port, and socket are optional)\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
\fI*user*\fR[:\fI*passwd*\fR]@\fI*host*\fR[:\fI*port*\fR][:\fI*socket*\fR] or
\fI*login\-path*\fR[:\fI*port*\fR][:\fI*socket*\fR]
.fi
.if n \{\
.RE
.\}
.PP
The utility permits users to discover slaves connected to the master\&.
.PP
The discover slaves option
\fBrequires\fR
all slaves use the
\-\-report\-host
and
\-\-report\-port
server startup variables with the correct hostname and port\&. If these are missing or report the incorrect information, the slave may not be detected and thus not included in the operation of the utility\&. The discover slaves option ignores any slaves to which it cannot connect\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
If discovered slaves are missing or report the incorrect information, the slaves health may not be reported correctly or the slave may not be listed at all\&.
.sp .5v
.RE
.PP
The utility permits the user to demote a master to a slave during the switchover operation\&. The
\fB\-\-demote\-master\fR
option tells the utility to, once the new master is established, make the old master a slave of the new master\&. This permits rotation of the master role among a set of servers\&.
.PP
The utility permits the user to specify an external script to execute before and after the switchover and failover commands\&. The user can specify these with the
\fB\-\-exec\-before\fR
and
\fB\-\-exec\-after\fR
options\&. The return code of the script is used to determine success thus each script must report 0 (success) to be considered successful\&. If a script returns a value other than 0, the result code is presented in an error message\&.
.PP
The utility permits the user to log all actions taken during the commands\&. The
\fB\-\-log\fR
option requires a valid path and filename of the file to use for logging operations\&. The log is active only when this option is specified\&. The option
\fB\-\-log\-age\fR
specifies the age in days that log entries are kept\&. The default is seven (7) days\&. Older entries are automatically deleted from the log file (but only if the
\fB\-\-log\fR
option is specified)\&.
.PP
The format of the log file includes the date and time of the event, the level of the event (informational \- INFO, warning \- WARN, error \- ERROR, critical failure \- CRITICAL), and the message reported by the utility\&.
.PP
The utility has a number of options each explained in more detail below\&. Some of the options are specific to certain commands\&. Warning messages are issued whenever an option is used that does not apply to the command requested\&. A brief overview of each command and its options is presented in the following paragraphs\&.
.PP
The start, stop, and reset commands require the
\fB\-\-slaves\fR
option to list all of the slaves in the topology\&. Optionally, the
\fB\-\-master\fR
option can be specified for the utility to check if the specified slaves are associated to the given master before executing the command, making sure that the command is only applied to slaves connected to the right replication master\&.
.PP
The options required for the elect, health and gtid commands include the
\fB\-\-master\fR
option to specify the existing master, and either the
\fB\-\-slaves\fR
option to list all of the slaves in the topology or the
\fB\-\-discover\-slaves\-login\fR
option to provide the user name and password to discover any slaves in the topology that are registered and connected to the master\&.
.PP
The options required for switchover include the
\fB\-\-master\fR
option to specify the existing master, the
\fB\-\-new\-master\fR
option to specify the candidate slave (the slave to become the new master), and either the
\fB\-\-slaves\fR
option to list the considered slaves in the topology or the
\fB\-\-discover\-slaves\-login\fR
option to provide the user name and password to discover any slaves in the topology that are registered and connected to the master\&.
.PP
The failover command requires only the
\fB\-\-slaves\fR
option to explicitly list all of the slaves in the topology because it is expected that the master is down when this command is used\&. It does not use the
\fB\-\-discover\-slaves\-login\fR
option and an error is presented if the user tries to include it\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
The option to pass in \-\-slaves without also passing in \-\-master was added in MySQL Utilities 1\&.6\&.0\&.
.sp .5v
.RE
.PP
Use the
\fB\-\-verbose\fR
option to see additional information in the health report and additional messages during switchover or failover\&.
COMMANDS.PP
The utility also provides a number of useful commands for managing a replication topology including the following\&.
.PP
\fBelect\fR
This command is available to only those servers supporting global transaction identifiers (GTIDs), perform slave election and report the candidate slave to use in the event a switchover or failover is required\&. Slave election is simply the first slave to meet the prerequisites\&. GTIDs are supported in version 5\&.6\&.5 and higher\&. This command requires the options
\fB\-\-master\fR
and either
\fB\-\-slaves\fR
or
\fB\-\-discover\-slaves\-login\fR\&.
.PP
\fBfailover\fR
This command is available to only those servers supporting GTIDs\&. Conduct failover to the best slave\&. The command tests each candidate slave listed for the prerequisites\&. Once a candidate slave is elected, it is made a slave of each of the other slaves thereby collecting any transactions executed on other slaves but not the candidate\&. In this way, the candidate becomes the most up\-to\-date slave\&. This command requires the
\fB\-\-slaves\fR
option\&. The
\fB\-\-discover\-slaves\-login\fR
option is not allowed because, for failover, the master is presumed to be offline or otherwise unreachable (so there is no way to discover the slaves)\&. The
\fB\-\-master\fR
option is ignored for this command\&.
.PP
\fBgtid\fR
This command is available to only those servers supporting GTIDs\&. It displays the contents of the GTID variables, @@GLOBAL\&.GTID_EXECUTED, @@GLOBAL\&.GTID_PURGED, and @@GLOBAL\&.GTID_OWNED\&. The command also displays universally unique identifiers (UUIDs) for all servers\&. This command requires one of the following combinations:
\fB\-\-master\fR
and
\fB\-\-slaves\fR, or
\fB\-\-master\fR
and
\fB\-\-discover\-slaves\-login\fR\&.
.PP
\fBhealth\fR
Display the replication health of the topology\&. By default, this includes the host name, port, role (MASTER or SLAVE) of the server, state of the server (UP = is connected, WARN = not connected but can ping, DOWN = not connected and cannot ping), the GTID_MODE, and health state\&. This command can be run with the following combination of options:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-master\fR
and
\fB\-\-slaves\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-master\fR
and
\fB\-\-discover\-slaves\-login\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-slaves\fR
.RE
.sp
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
The health column displays "no master specified" when generating a health report for a collection of slaves and no
\fB\-\-master\fR
option specified\&.
.sp .5v
.RE
.PP
The master health state is based on the following; if GTID_MODE=ON, the server must have binary log enabled, and there must exist a user with the REPLICATE SLAVE privilege\&.
.PP
The slave health state is based on the following; the IO_THREAD and SQL_THREADS must be running, it must be connected to the master, there are no errors, the slave delay for non\-gtid enabled scenarios is not more than the threshold provided by the
\fB\-\-max\-position\fR
and the slave is reading the correct master log file, and slave delay is not more than the
\fB\-\-seconds\-behind\fR
threshold option\&.
.PP
\fBreset\fR
Execute the STOP SLAVE and RESET SLAVE commands on all slaves\&. This command requires the
\fB\-\-slaves\fR
option\&. The
\fB\-\-discover\-slaves\-login\fR
option is not allowed because it might not provide the expected result, excluding slaves with the IO thread stopped\&. Optionally, the
\fB\-\-master\fR
option can also be used and in this case the utility performs an additional check to verify if the specified slaves are associated (replication is configured) to the given master\&.
.PP
\fBstart\fR
Execute the START SLAVE command on all slaves\&. This command requires the
\fB\-\-slaves\fR
option\&. The
\fB\-\-discover\-slaves\-login\fR
option is not allowed because it might not provide the expected result, excluding slaves with the IO thread stopped\&. Optionally, the
\fB\-\-master\fR
option can also be used and in this case the utility performs an additional check to verify if the specified slaves are associated (replication is configured) to the given master\&.
.PP
\fBstop\fR
Execute the STOP SLAVE command on all slaves\&. This command requires the
\fB\-\-slaves\fR
option\&. The
\fB\-\-discover\-slaves\-login\fR
option is not allowed because it might not provide the expected result, excluding slaves with the IO thread stopped\&. Optionally, the
\fB\-\-master\fR
option can also be used and in this case the utility performs an additional check to verify if the specified slaves are associated (replication is configured) to the given master\&.
.PP
\fBswitchover\fR
Perform slave promotion to a specified candidate slave as designated by the
\fB\-\-new\-master\fR
option\&. This command is available for both gtid\-enabled servers and non\-gtid\-enabled scenarios\&. This command requires one of the following combinations:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-master\fR,
\fB\-\-new\-master\fR
and
\fB\-\-slaves\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-master\fR,
\fB\-\-new\-master\fR
and
\fB\-\-discover\-slaves\-login\fR
.RE
OPTIONS.PP
\fBmysqlrpladmin\fR
accepts the following command\-line options:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-help
.sp
Display a help message and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-license
.sp
Display license information and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-candidates=\fIcandidate slave connections\fR
.sp
Connection information for candidate slave servers for failover\&. Valid only with failover command\&. List multiple slaves in comma\-separated list\&.
.sp
To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket\&. MySQL Utilities provides a number of ways to supply this information\&. All of the methods require specifying your choice via a command\-line option such as \-\-server, \-\-master, \-\-slave, etc\&. The methods include the following in order of most secure to least secure\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use login\-paths from your
\&.mylogin\&.cnf
file (encrypted, not visible)\&. Example :
\fIlogin\-path\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use a configuration file (unencrypted, not visible) Note: available in release\-1\&.5\&.0\&. Example :
\fIconfiguration\-file\-path\fR[:\fIsection\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Specify the data on the command\-line (unencrypted, visible)\&. Example :
\fIuser\fR[:\fIpasswd\fR]@\fIhost\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-demote\-master
.sp
Make master a slave after switchover\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-discover\-slaves\-login=\fIslave_login\fR
.sp
At startup, query master for all registered slaves and use the user name and password specified to connect\&. Supply the user and password in the form
\fIuser\fR[:\fIpasswd\fR] or
\fIlogin\-path\fR\&. For example, \-\-discover=joe:secret uses \*(Aqjoe\*(Aq as the user and \*(Aqsecret\*(Aq as the password for each discovered slave\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-exec\-after=\fIscript\fR
.sp
Name of external script to execute after failover or switchover\&. Script name may include the full path\&.
.sp
The return code of the script is used to determine success, thus each script must report 0 (success) to be considered successful\&. If a script returns a value other than 0, the result code is presented in an error message\&. The script specified using this option only runs if the switchover/failover executed with success\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-exec\-before=\fIscript\fR
.sp
Name of external script to execute before failover or switchover\&. Script name may include the full path\&.
.sp
The return code of the script is used to determine success, thus each script must report 0 (success) to be considered successful\&. If a script returns a value other than 0, the result code is presented in an error message\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-force
.sp
Ignore prerequisite checks or any inconsistencies found, such as errant transactions on the slaves or SQL thread errors, thus forcing the execution of the specified command\&. This option must be used carefully as it does not solve any detected issue, but only ignores them and displays a warning message\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-format=\fIformat\fR, \-f
\fIformat\fR
.sp
Display the replication health output in either grid (default), tab, csv, or vertical format\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-log=\fIlog_file\fR
.sp
Specify a log file to use for logging messages
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-log\-age=\fIdays\fR
.sp
Specify maximum age of log entries in days\&. Entries older than this are purged on startup\&. Default = 7 days\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-master=\fIconnection\fR
.sp
Connection information for the master server\&.
.sp
To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket\&. MySQL Utilities provides a number of ways to supply this information\&. All of the methods require specifying your choice via a command\-line option such as \-\-server, \-\-master, \-\-slave, etc\&. The methods include the following in order of most secure to least secure\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use login\-paths from your
\&.mylogin\&.cnf
file (encrypted, not visible)\&. Example :
\fIlogin\-path\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use a configuration file (unencrypted, not visible) Note: available in release\-1\&.5\&.0\&. Example :
\fIconfiguration\-file\-path\fR[:\fIsection\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Specify the data on the command\-line (unencrypted, visible)\&. Example :
\fIuser\fR[:\fIpasswd\fR]@\fIhost\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-max\-position=\fIposition\fR
.sp
Used to detect slave delay\&. The maximum difference between the master\*(Aqs log position and the slave\*(Aqs reported read position of the master\&. A value greater than this means the slave is too far behind the master\&. Default = 0\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-new\-master=\fIconnection\fR
.sp
Connection information for the slave to be used to replace the master for switchover\&. Valid only with switchover command\&.
.sp
To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket\&. MySQL Utilities provides a number of ways to supply this information\&. All of the methods require specifying your choice via a command\-line option such as \-\-server, \-\-master, \-\-slave, etc\&. The methods include the following in order of most secure to least secure\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use login\-paths from your
\&.mylogin\&.cnf
file (encrypted, not visible)\&. Example :
\fIlogin\-path\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use a configuration file (unencrypted, not visible) Note: available in release\-1\&.5\&.0\&. Example :
\fIconfiguration\-file\-path\fR[:\fIsection\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Specify the data on the command\-line (unencrypted, visible)\&. Example :
\fIuser\fR[:\fIpasswd\fR]@\fIhost\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-no\-health
.sp
Turn off health report after switchover or failover\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ping=\fInumber\fR
.sp
Number of ping attempts for detecting downed server\&. Note: on some platforms this is the same as number of seconds to wait for
\fIping\fR
to return\&. This value is also used to check down status of master\&. Failover waits for
\fIping\fR
seconds to check master response\&. If no response, failover event occurs\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-quiet, \-q
.sp
Turn off all messages for quiet execution\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-rpl\-user=\fIreplication_user\fR
.sp
The user and password for the replication user requirement, in the format:
\fIuser\fR[:\fIpassword\fR] or
\fIlogin\-path\fR\&. E\&.g\&. rpl:passwd Default = None\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-script\-threshold=\fIreturn_code\fR
.sp
Value for external scripts to trigger aborting the operation if result is greater than or equal to the threshold\&.
.sp
Default = None (no threshold checking)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-seconds\-behind=\fIseconds\fR
.sp
Used to detect slave delay\&. The maximum number of seconds behind the master permitted before slave is considered behind the master\&. Default = 0\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-slaves=\fIslave connections\fR
.sp
Connection information for slave servers\&. List multiple slaves in comma\-separated list\&. The list is evaluated literally whereby each server is considered a slave to the master listed regardless if they are a slave of the master\&.
.sp
To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket\&. MySQL Utilities provides a number of ways to supply this information\&. All of the methods require specifying your choice via a command\-line option such as \-\-server, \-\-master, \-\-slave, etc\&. The methods include the following in order of most secure to least secure\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use login\-paths from your
\&.mylogin\&.cnf
file (encrypted, not visible)\&. Example :
\fIlogin\-path\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use a configuration file (unencrypted, not visible) Note: available in release\-1\&.5\&.0\&. Example :
\fIconfiguration\-file\-path\fR[:\fIsection\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Specify the data on the command\-line (unencrypted, visible)\&. Example :
\fIuser\fR[:\fIpasswd\fR]@\fIhost\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl\-ca
.sp
The path to a file that contains a list of trusted SSL CAs\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl\-cert
.sp
The name of the SSL certificate file to use for establishing a secure connection\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl\-key
.sp
The name of the SSL key file to use for establishing a secure connection\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl
.sp
Specifies if the server connection requires use of SSL\&. If an encrypted connection cannot be established, the connection attempt fails\&. Default setting is 0 (SSL not required)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-timeout=\fIseconds\fR
.sp
Maximum timeout in seconds to wait for each replication command to complete\&. For example, timeout for slave waiting to catch up to master\&. Default = 300 seconds\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-verbose, \-v
.sp
Specify how much information to display\&. Use this option multiple times to increase the amount of information\&. For example,
\fB\-v\fR
= verbose,
\fB\-vv\fR
= more verbose,
\fB\-vvv\fR
= debug\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-version
.sp
Display version information and exit\&.
.RE
NOTES.PP
The login user must have the appropriate permissions to execute
\fBSHOW SLAVE STATUS\fR,
\fBSHOW MASTER STATUS\fR, and
\fBSHOW VARIABLES\fR
on the appropriate servers as well as grant the REPLICATE SLAVE privilege\&. The utility checks permissions for the master, slaves, and candidates at startup\&.
.PP
Mixing IP and hostnames is not recommended\&. The replication\-specific utilities attempts to compare hostnames and IP addresses as aliases for checking slave connectivity to the master\&. However, if your installation does not support reverse name lookup, the comparison could fail\&. Without the ability to do a reverse name lookup, the replication utilities could report a false negative that the slave is (not) connected to the master\&.
.PP
For example, if you setup replication using "MASTER_HOST=ubuntu\&.net" on the slave and later connect to the slave with
\fBmysqlrplcheck\fR
and have the master specified as "\-\-master=192\&.168\&.0\&.6" using the valid IP address for "ubuntu\&.net", you must have the ability to do a reverse name lookup to compare the IP (192\&.168\&.0\&.6) and the hostname (ubuntu\&.net) to determine if they are the same machine\&.
.PP
Similarly, if you use localhost to connect to the master, the health report may not show all of the slaves\&. It is best to use the actual hostname of the master when connecting or setting up replication\&.
.PP
If the user does not specify the
\fB\-\-rpl\-user\fR
and the user has specified the switchover or failover command, the utility checks to see if the slaves are using
\-\-master\-info\-repository=TABLE\&. If they are not, the utility stops with an error\&.
.PP
All the commands require either the
\fB\-\-slaves\fR
or
\fB\-\-discover\-slaves\-login\fR
option but both cannot be used at the same time\&. In fact, some commands only allow the use of the
\fB\-\-slaves\fR
option which is safer to specify the list slaves, because
\fB\-\-discover\-slaves\-login\fR
might not provide an up to date list of available slaves\&.
.PP
The path to the MySQL client tools should be included in the
PATH
environment variable in order to use the authentication mechanism with login\-paths\&. This permits the utility to use the
\fBmy_print_defaults\fR
tools which is required to read the login\-path values from the login configuration file (\&.mylogin\&.cnf)\&.
EXAMPLES.PP
To perform best slave election for a topology with GTID_MODE=ON (server version 5\&.6\&.5 or higher) where all slaves are specified with the
\fB\-\-slaves\fR
option, run the following command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlrpladmin \-\-master=root@localhost:3331 \e\fR
          \fB\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 elect\fR
# Electing candidate slave from known slaves\&.
# Best slave found is located on localhost:3332\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To perform best slave election supplying a candidate list, use the following command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlrpladmin \-\-master=root@localhost:3331 \e\fR
  \fB\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \e\fR
  \fB\-\-candidates=root@localhost:3333,root@localhost:3334 elect\fR
# Electing candidate slave from candidate list then slaves list\&.
# Best slave found is located on localhost:3332\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To perform failover after a master has failed, use the following command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlrpladmin  \e\fR
  \fB\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \e\fR
  \fB\-\-candidates=root@localhost:3333,root@localhost:3334 failover\fR
# Performing failover\&.
# Candidate slave localhost:3333 will become the new master\&.
# Preparing candidate for failover\&.
# Creating replication user if it does not exist\&.
# Stopping slaves\&.
# Performing STOP on all slaves\&.
# Switching slaves to new master\&.
# Starting slaves\&.
# Performing START on all slaves\&.
# Checking slaves for errors\&.
# Failover complete\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To see the replication health of a topology with GTID_MODE=ON (server version 5\&.6\&.5 or higher) and discover all slaves attached to the master, run the following command\&. We use the result of the failover command above\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlrpladmin \-\-master=root@localhost:3333 \e\fR
  \fB\-\-slaves=root@localhost:3332,root@localhost:3334 health\fR
# Getting health for master: localhost:3333\&.
#
# Replication Topology Health:
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| host       | port  | role    | state  | gtid_mode  | health  |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| localhost  | 3333  | MASTER  | UP     | ON         | OK      |
| localhost  | 3332  | SLAVE   | UP     | ON         | OK      |
| localhost  | 3334  | SLAVE   | UP     | ON         | OK      |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To view a detailed replication health report but with all of the replication health checks revealed, use the
\fB\-\-verbose\fR
option as shown below\&. In this example, we use vertical format to make viewing easier\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlrpladmin \-\-master=root@localhost:3331 \e\fR
          \fB\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \e\fR
          \fB\-\-verbose health\fR
# Getting health for master: localhost:3331\&.
# Attempting to contact localhost \&.\&.\&. Success
# Attempting to contact localhost \&.\&.\&. Success
# Attempting to contact localhost \&.\&.\&. Success
# Attempting to contact localhost \&.\&.\&. Success
#
# Replication Topology Health:
*************************       1\&. row *************************
            host: localhost
            port: 3331
            role: MASTER
           state: UP
       gtid_mode: ON
          health: OK
         version: 5\&.6\&.5\-m8\-debug\-log
 master_log_file: mysql\-bin\&.000001
  master_log_pos: 571
       IO_Thread:
      SQL_Thread:
     Secs_Behind:
 Remaining_Delay:
    IO_Error_Num:
        IO_Error:
*************************       2\&. row *************************
            host: localhost
            port: 3332
            role: SLAVE
           state: UP
       gtid_mode: ON
          health: OK
         version: 5\&.6\&.5\-m8\-debug\-log
 master_log_file: mysql\-bin\&.000001
  master_log_pos: 571
       IO_Thread: Yes
      SQL_Thread: Yes
     Secs_Behind: 0
 Remaining_Delay: No
    IO_Error_Num: 0
        IO_Error:
*************************       3\&. row *************************
            host: localhost
            port: 3333
            role: SLAVE
           state: UP
       gtid_mode: ON
          health: OK
         version: 5\&.6\&.5\-m8\-debug\-log
 master_log_file: mysql\-bin\&.000001
  master_log_pos: 571
       IO_Thread: Yes
      SQL_Thread: Yes
     Secs_Behind: 0
 Remaining_Delay: No
    IO_Error_Num: 0
        IO_Error:
*************************       4\&. row *************************
            host: localhost
            port: 3334
            role: SLAVE
           state: UP
       gtid_mode: ON
          health: OK
         version: 5\&.6\&.5\-m8\-debug\-log
 master_log_file: mysql\-bin\&.000001
  master_log_pos: 571
       IO_Thread: Yes
      SQL_Thread: Yes
     Secs_Behind: 0
 Remaining_Delay: No
    IO_Error_Num: 0
        IO_Error:
4 rows\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To run the same failover command above, but specify a log file, use the following command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlrpladmin  \e\fR
  \fB\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \e\fR
  \fB\-\-candidates=root@localhost:3333,root@localhost:3334 \e\fR
  \fB\-\-log=test_log\&.txt failover\fR
# Performing failover\&.
# Candidate slave localhost:3333 will become the new master\&.
# Preparing candidate for failover\&.
# Creating replication user if it does not exist\&.
# Stopping slaves\&.
# Performing STOP on all slaves\&.
# Switching slaves to new master\&.
# Starting slaves\&.
# Performing START on all slaves\&.
# Checking slaves for errors\&.
# Failover complete\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
After this command, the log file contains entries like the following:
.sp
.if n \{\
.RS 4
.\}
.nf
2012\-03\-19 14:44:17 PM INFO Executing failover command\&.\&.\&.
2012\-03\-19 14:44:17 PM INFO Performing failover\&.
2012\-03\-19 14:44:17 PM INFO Candidate slave localhost:3333 will become the new master\&.
2012\-03\-19 14:44:17 PM INFO Preparing candidate for failover\&.
2012\-03\-19 14:44:19 PM INFO Creating replication user if it does not exist\&.
2012\-03\-19 14:44:19 PM INFO Stopping slaves\&.
2012\-03\-19 14:44:19 PM INFO Performing STOP on all slaves\&.
2012\-03\-19 14:44:19 PM INFO Switching slaves to new master\&.
2012\-03\-19 14:44:20 PM INFO Starting slaves\&.
2012\-03\-19 14:44:20 PM INFO Performing START on all slaves\&.
2012\-03\-19 14:44:20 PM INFO Checking slaves for errors\&.
2012\-03\-19 14:44:21 PM INFO Failover complete\&.
2012\-03\-19 14:44:21 PM INFO \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
To perform switchover and demote the current master to a slave, use the following command\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlrpladmin \-\-master=root@localhost:3331 \e\fR
  \fB\-\-slaves=root@localhost:3332,root@localhost:3333,root@localhost:3334 \e\fR
  \fB\-\-new\-master=root@localhost:3332 \-\-demote\-master switchover\fR
# Performing switchover from master at localhost:3331 to slave at localhost:3332\&.
# Checking candidate slave prerequisites\&.
# Waiting for slaves to catch up to old master\&.
# Stopping slaves\&.
# Performing STOP on all slaves\&.
# Demoting old master to be a slave to the new master\&.
# Switching slaves to new master\&.
# Starting all slaves\&.
# Performing START on all slaves\&.
# Checking slaves for errors\&.
# Switchover complete\&.
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
If the replication health report is generated on the topology following the above command, it displays the old master as a slave as shown below\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
# Replication Topology Health:
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| host       | port  | role    | state  | gtid_mode  | health  |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| localhost  | 3332  | MASTER  | UP     | ON         | OK      |
| localhost  | 3331  | SLAVE   | UP     | ON         | OK      |
| localhost  | 3333  | SLAVE   | UP     | ON         | OK      |
| localhost  | 3334  | SLAVE   | UP     | ON         | OK      |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
.fi
.if n \{\
.RE
.\}
.PP
You can use the discover slaves feature, if and only if all slaves report their host and port to the master\&. A sample command to generate a replication health report with discovery is shown below\&. Note that the option
\fB\-\-discover\-slaves\-login\fR
cannot be used in conjunction with the
\fB\-\-slaves\fR
option\&.:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlrpladmin \-\-master=root@localhost:3332 \-\-discover\-slaves\-login=root  health\fR
# Discovering slaves for master at localhost:3332
# Discovering slave at localhost:3331
# Found slave: localhost:3331
# Discovering slave at localhost:3333
# Found slave: localhost:3333
# Discovering slave at localhost:3334
# Found slave: localhost:3334
# Checking privileges\&.
#
# Replication Topology Health:
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| host       | port  | role    | state  | gtid_mode  | health  |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
| localhost  | 3332  | MASTER  | UP     | ON         | OK      |
| localhost  | 3331  | SLAVE   | UP     | ON         | OK      |
| localhost  | 3333  | SLAVE   | UP     | ON         | OK      |
| localhost  | 3334  | SLAVE   | UP     | ON         | OK      |
+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+
# \&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.sp
PERMISSIONS REQUIRED.PP
The users on the master need the following privileges: SELECT and INSERT privileges on mysql database, REPLICATION SLAVE, REPLICATION CLIENT and GRANT OPTION\&. The slave users need the SUPER privilege\&. The repl user, used as the argument for the
\fB\-\-rpl\-user\fR
option, is either created automatically or if it exists, it needs the REPLICATION SLAVE privilege\&.
.PP
To run the
\fBmysqlrpladmin\fR
utility with the health command, the account used on the master needs an extra SUPER privilege\&.
.PP
As for the switchover command all the users need the following privileges: SUPER, GRANT OPTION, SELECT, RELOAD, DROP, CREATE and REPLICATION SLAVE
.SH "COPYRIGHT"
.br
.PP
Copyright \(co 2006, 2017, Oracle and/or its affiliates. All rights reserved.
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
.sp
.SH "SEE ALSO"
For more information, please refer to the MySQL Utilities and Fabric
documentation, which is available online at
http://dev.mysql.com/doc/index-utils-fabric.html
.SH AUTHOR
Oracle Corporation (http://dev.mysql.com/).
